<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      display: grid;
      grid-template-columns: repeat(3, 100px);
      grid-template-rows: repeat(3, 100px);

      /* 有时候，一些项目的指定位置，在现有网格的外部。*/
      /* 比如网格只有3列，但是某一个项目指定在第5行。这时，浏览器会自动生成多余的网格，以便放置项目。 */
      /* grid-auto-columns属性和grid-auto-rows属性用来设置，浏览器自动创建的多余网格的列宽和行高 */
      /* 剩余项目的grid-auto-columns、grid-auto-rows与grid-auto-flow有关 */
      grid-auto-flow: column;
      grid-auto-columns: 200px 100px 100px;/* grid-auto-flow: row;时失效 */
      grid-auto-rows: 200px 100px 100px;  /* grid-auto-flow: column;时失效 */
      
    }

    .box .item {
      background-color: #ccc;
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
    <div class="item">5</div>
    <div class="item">6</div>
    <div class="item">7</div>
    <div class="item">8</div>
    <div class="item">9</div>
    <div class="item">10</div>
    <div class="item">10</div>
    <div class="item">10</div>
    <div class="item">10</div>
  </div>
</body>
</html>